package com.stoken.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.stoken.domain.MemberAchievement;
import com.symbio.dao.hibernate.GenericDaoImpl;


@Repository("memberAchievementDao")
public class MemberAchievementDao extends GenericDaoImpl<MemberAchievement, Long> {

	
	/**
	 * 根据用户名得到改会员业绩信息
	 * @param baseName
	 * @return
	 */
	public MemberAchievement getMemberAchievementByBaseName(String baseName){
		return this.find("from MemberAchievement where baseUsername.baseUsername = ?", new Object[]{baseName});
		
	}
	/**
	 * 统计产生对碰奖金的会员
	 * @return
	 */
	public List<MemberAchievement> getMemberAchivCBouns(){
		return this.findList("from MemberAchievement where achievementHit > ?", new Object[]{0});	
		
	}
	
	public void initMemberAchivementByEveyOne(){
		String updateSQL = "update MemberAchievement set achievementHit = 0,achievementRightNew=0,achievementLeftNew=0";
		this.getSession().createQuery(updateSQL).executeUpdate();
	}

	
}


